﻿/* * 版 本 PIT-ADMS V7.0.3 敏捷开发框架
 * Copyright (c) 2013-2018 Hexagon PPM
 * 创建人：超级管理员
 * 日  期：2020-12-04 15:20
 * 描  述：项目管理
 */
var refreshGirdData;
var Enter;
var GetProjectId;

var bootstrap = function ($, learun) {
    "use strict";
    var page = {
        init: function () {
            page.initGird();
            page.bind();
        },
        bind: function () {
            // 刷新
            $('#lr_refresh').on('click', function () {
                location.reload();
            });
            //查询
            $('#btn_Search').on('click', function () {
                page.search($('.lr-layout-tool-left').lrGetFormData());
            });

        },
        // 初始化列表
        initGird: function () {
            $('#gridtable').jfGrid({
                url: top.$.rootUrl + '/ZZDT_EC/ec_project/GetProjectSelectPageList',
                headData: [
                    { label: "项目名称", name: "ProjectName", width: 400, align: "left", sort: false },
                    { label: "项目代号", name: "ProjectCode", width: 400, align: "left", sort: false },
                    {
                        label: "操作", name: "Operation", width: 120, align: "center", sort: false, formatter: function (value, row, op, $cell) {
                            return "<a style='color: #FF8C00;text-decoration: underline;' onclick='Enter(\"" + row.ProjectId + "\")'>\[进入项目平台]</a>\
                            "
                        }
                    },
                    { label: "", name: "" }
                ],
                mainId: 'ProjectId',
                sidx: "CreateTime ",
                sord: "DESC",
                isPage: true
            });
            page.search();
        },
        search: function (param) {
            param = param || {};
            $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
        }
    };
    refreshGirdData = function () {
        $('#gridtable').jfGridSet('reload');
    };
    Enter = function (keyValue) {
        if (!keyValue) {
            //top.learun.language.get('请选中需要进入的项目！', function (text) {
            //    learun.alert.warning(text);
            //});
            return;
        } else {
            window.parent.location.href = top.$.rootUrl + '/Home/AdminProjectManage?ProjectId=' + keyValue;
        }
    };

    GetProjectId = function () {
        var ProjectId = $('#gridtable').jfGridValue('ProjectId');
        window.parent.location.href = top.$.rootUrl + '/Home/AdminProjectManage?ProjectId=' + ProjectId;
    };
    page.init();
}
